<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::Indexer - rubygems: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="UserInteraction.html">Gem::UserInteraction</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-build_indices">#build_indices</a>
    <li ><a href="#method-i-build_marshal_gemspecs">#build_marshal_gemspecs</a>
    <li ><a href="#method-i-build_modern_index">#build_modern_index</a>
    <li ><a href="#method-i-build_modern_indices">#build_modern_indices</a>
    <li ><a href="#method-i-compact_specs">#compact_specs</a>
    <li ><a href="#method-i-compress">#compress</a>
    <li ><a href="#method-i-compress_indices">#compress_indices</a>
    <li ><a href="#method-i-gem_file_list">#gem_file_list</a>
    <li ><a href="#method-i-generate_index">#generate_index</a>
    <li ><a href="#method-i-gzip">#gzip</a>
    <li ><a href="#method-i-install_indices">#install_indices</a>
    <li ><a href="#method-i-make_temp_directories">#make_temp_directories</a>
    <li ><a href="#method-i-map_gems_to_specs">#map_gems_to_specs</a>
    <li ><a href="#method-i-paranoid">#paranoid</a>
    <li ><a href="#method-i-update_index">#update_index</a>
    <li ><a href="#method-i-update_specs_index">#update_specs_index</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::Indexer">
    <h1 id="class-Gem::Indexer" class="class">
      class Gem::Indexer
    </h1>

    <section class="description">
    
<p>Top level class for building the gem repository index.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-build_modern" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">build_modern</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Build indexes for RubyGems 1.2.0 and newer when true</p>
              </div>
            </div>
          <div id="attribute-i-dest_directory" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dest_directory</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Index install location</p>
              </div>
            </div>
          <div id="attribute-i-dest_latest_specs_index" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dest_latest_specs_index</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Latest specs index install location</p>
              </div>
            </div>
          <div id="attribute-i-dest_prerelease_specs_index" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dest_prerelease_specs_index</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Prerelease specs index install location</p>
              </div>
            </div>
          <div id="attribute-i-dest_specs_index" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">dest_specs_index</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Specs index install location</p>
              </div>
            </div>
          <div id="attribute-i-directory" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">directory</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Index build directory</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(directory, options = {})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Create an indexer that will index the gems in <code>directory</code>.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;fileutils&quot;</span>
  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;tmpdir&quot;</span>
  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;zlib&quot;</span>

  <span class="ruby-identifier">options</span> = { <span class="ruby-value">:build_modern</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span> }.<span class="ruby-identifier">merge</span> <span class="ruby-identifier">options</span>

  <span class="ruby-ivar">@build_modern</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:build_modern</span>]

  <span class="ruby-ivar">@dest_directory</span> = <span class="ruby-identifier">directory</span>
  <span class="ruby-ivar">@directory</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mktmpdir</span> <span class="ruby-string">&quot;gem_generate_index&quot;</span>

  <span class="ruby-identifier">marshal_name</span> = <span class="ruby-node">&quot;Marshal.#{Gem.marshal_version}&quot;</span>

  <span class="ruby-ivar">@master_index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-string">&quot;yaml&quot;</span>
  <span class="ruby-ivar">@marshal_index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-identifier">marshal_name</span>

  <span class="ruby-ivar">@quick_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-string">&quot;quick&quot;</span>
  <span class="ruby-ivar">@quick_marshal_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@quick_dir</span>, <span class="ruby-identifier">marshal_name</span>
  <span class="ruby-ivar">@quick_marshal_dir_base</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-string">&quot;quick&quot;</span>, <span class="ruby-identifier">marshal_name</span> <span class="ruby-comment"># FIX: UGH</span>

  <span class="ruby-ivar">@quick_index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@quick_dir</span>, <span class="ruby-string">&quot;index&quot;</span>
  <span class="ruby-ivar">@latest_index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@quick_dir</span>, <span class="ruby-string">&quot;latest_index&quot;</span>

  <span class="ruby-ivar">@specs_index</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-node">&quot;specs.#{Gem.marshal_version}&quot;</span>
  <span class="ruby-ivar">@latest_specs_index</span> =
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@directory</span>, <span class="ruby-node">&quot;latest_specs.#{Gem.marshal_version}&quot;</span>)
  <span class="ruby-ivar">@prerelease_specs_index</span> =
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@directory</span>, <span class="ruby-node">&quot;prerelease_specs.#{Gem.marshal_version}&quot;</span>)
  <span class="ruby-ivar">@dest_specs_index</span> =
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dest_directory</span>, <span class="ruby-node">&quot;specs.#{Gem.marshal_version}&quot;</span>)
  <span class="ruby-ivar">@dest_latest_specs_index</span> =
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dest_directory</span>, <span class="ruby-node">&quot;latest_specs.#{Gem.marshal_version}&quot;</span>)
  <span class="ruby-ivar">@dest_prerelease_specs_index</span> =
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dest_directory</span>, <span class="ruby-node">&quot;prerelease_specs.#{Gem.marshal_version}&quot;</span>)

  <span class="ruby-ivar">@files</span> = []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-build_indices" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build_indices</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Build various indices</p>

                              <div class="method-source-code" id="build_indices-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 88</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_indices</span>
  <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">map_gems_to_specs</span> <span class="ruby-identifier">gem_file_list</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">_resort!</span> <span class="ruby-identifier">specs</span>
  <span class="ruby-identifier">build_marshal_gemspecs</span> <span class="ruby-identifier">specs</span>
  <span class="ruby-identifier">build_modern_indices</span> <span class="ruby-identifier">specs</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@build_modern</span>

  <span class="ruby-identifier">compress_indices</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-build_marshal_gemspecs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build_marshal_gemspecs</span><span
                                class="method-args">(specs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Builds Marshal quick index gemspecs.</p>

                              <div class="method-source-code" id="build_marshal_gemspecs-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_marshal_gemspecs</span>(<span class="ruby-identifier">specs</span>)
  <span class="ruby-identifier">count</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">count</span>
  <span class="ruby-identifier">progress</span> = <span class="ruby-identifier">ui</span>.<span class="ruby-identifier">progress_reporter</span> <span class="ruby-identifier">count</span>,
                                  <span class="ruby-node">&quot;Generating Marshal quick index gemspecs for #{count} gems&quot;</span>,
                                  <span class="ruby-string">&quot;Complete&quot;</span>

  <span class="ruby-identifier">files</span> = []

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">time</span> <span class="ruby-string">&quot;Generated Marshal quick index gemspecs&quot;</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">default_gem?</span>
      <span class="ruby-identifier">spec_file_name</span> = <span class="ruby-node">&quot;#{spec.original_name}.gemspec.rz&quot;</span>
      <span class="ruby-identifier">marshal_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@quick_marshal_dir</span>, <span class="ruby-identifier">spec_file_name</span>

      <span class="ruby-identifier">marshal_zipped</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">deflate</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">spec</span>)

      <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span> <span class="ruby-identifier">marshal_name</span>, <span class="ruby-string">&quot;wb&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">io</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">marshal_zipped</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">marshal_name</span>

      <span class="ruby-identifier">progress</span>.<span class="ruby-identifier">updated</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">original_name</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">progress</span>.<span class="ruby-identifier">done</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@quick_marshal_dir</span>

  <span class="ruby-identifier">files</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-build_modern_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build_modern_index</span><span
                                class="method-args">(index, file, name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Build a single index for RubyGems 1.2 and newer</p>

                              <div class="method-source-code" id="build_modern_index-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 136</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_modern_index</span>(<span class="ruby-identifier">index</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Generating #{name} index&quot;</span>

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">time</span> <span class="ruby-node">&quot;Generated #{name} index&quot;</span> <span class="ruby-keyword">do</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file</span>, <span class="ruby-string">&quot;wb&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">index</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
        <span class="ruby-comment"># We have to splat here because latest_specs is an array, while the</span>
        <span class="ruby-comment"># others are hashes.</span>
        <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">last</span>
        <span class="ruby-identifier">platform</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">original_platform</span>

        <span class="ruby-comment"># win32-api-1.0.4-x86-mswin32-60</span>
        <span class="ruby-keyword">unless</span> <span class="ruby-constant">String</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">platform</span>
          <span class="ruby-identifier">alert_warning</span> <span class="ruby-node">&quot;Skipping invalid platform in gem: #{spec.full_name}&quot;</span>
          <span class="ruby-keyword">next</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">platform</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span><span class="ruby-operator">::</span><span class="ruby-constant">RUBY</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">platform</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">platform</span>.<span class="ruby-identifier">empty?</span>
        [<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">version</span>, <span class="ruby-identifier">platform</span>]
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">compact_specs</span>(<span class="ruby-identifier">specs</span>)
      <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">specs</span>, <span class="ruby-identifier">io</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-build_modern_indices" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">build_modern_indices</span><span
                                class="method-args">(specs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Builds indices for RubyGems 1.2 and newer. Handles full, latest, prerelease</p>

                              <div class="method-source-code" id="build_modern_indices-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 166</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_modern_indices</span>(<span class="ruby-identifier">specs</span>)
  <span class="ruby-identifier">prerelease</span>, <span class="ruby-identifier">released</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">partition</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span>.<span class="ruby-identifier">prerelease?</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">latest_specs</span> =
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">_latest_specs</span> <span class="ruby-identifier">specs</span>

  <span class="ruby-identifier">build_modern_index</span>(<span class="ruby-identifier">released</span>.<span class="ruby-identifier">sort</span>, <span class="ruby-ivar">@specs_index</span>, <span class="ruby-string">&quot;specs&quot;</span>)
  <span class="ruby-identifier">build_modern_index</span>(<span class="ruby-identifier">latest_specs</span>.<span class="ruby-identifier">sort</span>, <span class="ruby-ivar">@latest_specs_index</span>, <span class="ruby-string">&quot;latest specs&quot;</span>)
  <span class="ruby-identifier">build_modern_index</span>(<span class="ruby-identifier">prerelease</span>.<span class="ruby-identifier">sort</span>, <span class="ruby-ivar">@prerelease_specs_index</span>,
                     <span class="ruby-string">&quot;prerelease specs&quot;</span>)

  <span class="ruby-ivar">@files</span> <span class="ruby-operator">+=</span> [<span class="ruby-ivar">@specs_index</span>,
             <span class="ruby-node">&quot;#{@specs_index}.gz&quot;</span>,
             <span class="ruby-ivar">@latest_specs_index</span>,
             <span class="ruby-node">&quot;#{@latest_specs_index}.gz&quot;</span>,
             <span class="ruby-ivar">@prerelease_specs_index</span>,
             <span class="ruby-node">&quot;#{@prerelease_specs_index}.gz&quot;</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compact_specs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compact_specs</span><span
                                class="method-args">(specs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compacts Marshal output for the specs index data source by using identical objects as much as possible.</p>

                              <div class="method-source-code" id="compact_specs-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 234</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compact_specs</span>(<span class="ruby-identifier">specs</span>)
  <span class="ruby-identifier">names</span> = {}
  <span class="ruby-identifier">versions</span> = {}
  <span class="ruby-identifier">platforms</span> = {}

  <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">platform</span>)<span class="ruby-operator">|</span>
    <span class="ruby-identifier">names</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">name</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">names</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">name</span>
    <span class="ruby-identifier">versions</span>[<span class="ruby-identifier">version</span>] = <span class="ruby-identifier">version</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">versions</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">version</span>
    <span class="ruby-identifier">platforms</span>[<span class="ruby-identifier">platform</span>] = <span class="ruby-identifier">platform</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">platforms</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">platform</span>

    [<span class="ruby-identifier">names</span>[<span class="ruby-identifier">name</span>], <span class="ruby-identifier">versions</span>[<span class="ruby-identifier">version</span>], <span class="ruby-identifier">platforms</span>[<span class="ruby-identifier">platform</span>]]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compress" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compress</span><span
                                class="method-args">(filename, extension)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compress <code>filename</code> with <code>extension</code>.</p>

                              <div class="method-source-code" id="compress-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 251</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compress</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">extension</span>)
  <span class="ruby-identifier">data</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">read_binary</span> <span class="ruby-identifier">filename</span>

  <span class="ruby-identifier">zipped</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">deflate</span> <span class="ruby-identifier">data</span>

  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span> <span class="ruby-node">&quot;#{filename}.#{extension}&quot;</span>, <span class="ruby-string">&quot;wb&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">io</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">zipped</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-compress_indices" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compress_indices</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Compresses indices on disk</p>

                              <div class="method-source-code" id="compress_indices-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 218</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compress_indices</span>
  <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Compressing indices&quot;</span>

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">time</span> <span class="ruby-string">&quot;Compressed indices&quot;</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@build_modern</span>
      <span class="ruby-identifier">gzip</span> <span class="ruby-ivar">@specs_index</span>
      <span class="ruby-identifier">gzip</span> <span class="ruby-ivar">@latest_specs_index</span>
      <span class="ruby-identifier">gzip</span> <span class="ruby-ivar">@prerelease_specs_index</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gem_file_list" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gem_file_list</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>List of gem file names to index.</p>

                              <div class="method-source-code" id="gem_file_list-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 264</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gem_file_list</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">glob_files_in_dir</span>(<span class="ruby-string">&quot;*.gem&quot;</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dest_directory</span>, <span class="ruby-string">&quot;gems&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_index</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Builds and installs indices.</p>

                              <div class="method-source-code" id="generate_index-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 271</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_index</span>
  <span class="ruby-identifier">make_temp_directories</span>
  <span class="ruby-identifier">build_indices</span>
  <span class="ruby-identifier">install_indices</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">SignalException</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-ivar">@directory</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gzip" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gzip</span><span
                                class="method-args">(filename)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Zlib::GzipWriter wrapper that gzips <code>filename</code> on disk.</p>

                              <div class="method-source-code" id="gzip-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 283</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gzip</span>(<span class="ruby-identifier">filename</span>)
  <span class="ruby-constant">Zlib</span><span class="ruby-operator">::</span><span class="ruby-constant">GzipWriter</span>.<span class="ruby-identifier">open</span> <span class="ruby-node">&quot;#{filename}.gz&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">io</span>.<span class="ruby-identifier">write</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">read_binary</span>(<span class="ruby-identifier">filename</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-install_indices" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">install_indices</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Install generated indices into the destination directory.</p>

                              <div class="method-source-code" id="install_indices-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 292</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">install_indices</span>
  <span class="ruby-identifier">verbose</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">really_verbose</span>

  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Moving index into production dir #{@dest_directory}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>

  <span class="ruby-identifier">files</span> = <span class="ruby-ivar">@files</span>
  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@quick_marshal_dir</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">files</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@quick_dir</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">files</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@quick_marshal_dir</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">files</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@quick_dir</span>)
    <span class="ruby-identifier">files</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@quick_marshal_dir</span>

    <span class="ruby-identifier">dst_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@dest_directory</span>, <span class="ruby-ivar">@quick_marshal_dir_base</span>)

    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">dst_name</span>), <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>
    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">dst_name</span>, <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>
    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span>(<span class="ruby-ivar">@quick_marshal_dir</span>, <span class="ruby-identifier">dst_name</span>,
                 <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>, <span class="ruby-value">:force</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">files</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">%r{^#{Regexp.escape @directory}/?}</span>, <span class="ruby-string">&quot;&quot;</span>) <span class="ruby-comment"># HACK?</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">src_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-identifier">file</span>
    <span class="ruby-identifier">dst_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@dest_directory</span>, <span class="ruby-identifier">file</span>

    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">dst_name</span>, <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>
    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span>(<span class="ruby-identifier">src_name</span>, <span class="ruby-ivar">@dest_directory</span>,
                 <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>, <span class="ruby-value">:force</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-make_temp_directories" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">make_temp_directories</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Make directories for index generation</p>

                              <div class="method-source-code" id="make_temp_directories-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 328</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">make_temp_directories</span>
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-ivar">@directory</span>
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-value">:mode</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-value">0o700</span>
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span> <span class="ruby-ivar">@quick_marshal_dir</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-map_gems_to_specs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">map_gems_to_specs</span><span
                                class="method-args">(gems)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="map_gems_to_specs-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 186</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">map_gems_to_specs</span>(<span class="ruby-identifier">gems</span>)
  <span class="ruby-identifier">gems</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gemfile</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">gemfile</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">alert_warning</span> <span class="ruby-node">&quot;Skipping zero-length gem: #{gemfile}&quot;</span>
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">spec</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Package</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gemfile</span>).<span class="ruby-identifier">spec</span>
      <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">loaded_from</span> = <span class="ruby-identifier">gemfile</span>

      <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">abbreviate</span>
      <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">sanitize</span>

      <span class="ruby-identifier">spec</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SignalException</span>
      <span class="ruby-identifier">alert_error</span> <span class="ruby-string">&quot;Received signal, exiting&quot;</span>
      <span class="ruby-identifier">raise</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-identifier">msg</span> = [<span class="ruby-node">&quot;Unable to process #{gemfile}&quot;</span>,
             <span class="ruby-node">&quot;#{e.message} (#{e.class})&quot;</span>,
             <span class="ruby-node">&quot;\t#{e.backtrace.join &quot;\n\t&quot;}&quot;</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
      <span class="ruby-identifier">alert_error</span> <span class="ruby-identifier">msg</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>.<span class="ruby-identifier">compact</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-paranoid" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">paranoid</span><span
                                class="method-args">(path, extension)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Ensure <code>path</code> and path with <code>extension</code> are identical.</p>

                              <div class="method-source-code" id="paranoid-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 337</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">paranoid</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">extension</span>)
  <span class="ruby-identifier">data</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">read_binary</span> <span class="ruby-identifier">path</span>
  <span class="ruby-identifier">compressed_data</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">read_binary</span> <span class="ruby-node">&quot;#{path}.#{extension}&quot;</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">inflate</span>(<span class="ruby-identifier">compressed_data</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Compressed file #{compressed_path} does not match uncompressed file #{path}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_index</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Perform an in-place update of the repository from newly added gems.</p>

                              <div class="method-source-code" id="update_index-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 349</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_index</span>
  <span class="ruby-identifier">make_temp_directories</span>

  <span class="ruby-identifier">specs_mtime</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-ivar">@dest_specs_index</span>).<span class="ruby-identifier">mtime</span>
  <span class="ruby-identifier">newest_mtime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">updated_gems</span> = <span class="ruby-identifier">gem_file_list</span>.<span class="ruby-identifier">select</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gem</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">gem_mtime</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">gem</span>).<span class="ruby-identifier">mtime</span>
    <span class="ruby-identifier">newest_mtime</span> = <span class="ruby-identifier">gem_mtime</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">gem_mtime</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">newest_mtime</span>
    <span class="ruby-identifier">gem_mtime</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">specs_mtime</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">updated_gems</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;No new gems&quot;</span>
    <span class="ruby-identifier">terminate_interaction</span> <span class="ruby-value">0</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">map_gems_to_specs</span> <span class="ruby-identifier">updated_gems</span>
  <span class="ruby-identifier">prerelease</span>, <span class="ruby-identifier">released</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">partition</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span>.<span class="ruby-identifier">prerelease?</span> }

  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">build_marshal_gemspecs</span> <span class="ruby-identifier">specs</span>

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">time</span> <span class="ruby-string">&quot;Updated indexes&quot;</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">update_specs_index</span> <span class="ruby-identifier">released</span>, <span class="ruby-ivar">@dest_specs_index</span>, <span class="ruby-ivar">@specs_index</span>
    <span class="ruby-identifier">update_specs_index</span> <span class="ruby-identifier">released</span>, <span class="ruby-ivar">@dest_latest_specs_index</span>, <span class="ruby-ivar">@latest_specs_index</span>
    <span class="ruby-identifier">update_specs_index</span>(<span class="ruby-identifier">prerelease</span>,
                       <span class="ruby-ivar">@dest_prerelease_specs_index</span>,
                       <span class="ruby-ivar">@prerelease_specs_index</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">compress_indices</span>

  <span class="ruby-identifier">verbose</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">really_verbose</span>

  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Updating production dir #{@dest_directory}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>

  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@specs_index</span>
  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@specs_index}.gz&quot;</span>
  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@latest_specs_index</span>
  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@latest_specs_index}.gz&quot;</span>
  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@prerelease_specs_index</span>
  <span class="ruby-identifier">files</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@prerelease_specs_index}.gz&quot;</span>

  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">files</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">%r{^#{Regexp.escape @directory}/?}</span>, <span class="ruby-string">&quot;&quot;</span>) <span class="ruby-comment"># HACK?</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">src_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@directory</span>, <span class="ruby-identifier">file</span>
    <span class="ruby-identifier">dst_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@dest_directory</span>, <span class="ruby-identifier">file</span> <span class="ruby-comment"># REFACTOR: duped above</span>

    <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span> <span class="ruby-identifier">src_name</span>, <span class="ruby-identifier">dst_name</span>, <span class="ruby-value">:verbose</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">verbose</span>,
                                     <span class="ruby-value">:force</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">true</span>

    <span class="ruby-constant">File</span>.<span class="ruby-identifier">utime</span> <span class="ruby-identifier">newest_mtime</span>, <span class="ruby-identifier">newest_mtime</span>, <span class="ruby-identifier">dst_name</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-ivar">@directory</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_specs_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_specs_index</span><span
                                class="method-args">(index, source, dest)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Combines specs in <code>index</code> and <code>source</code> then writes out a new copy to <code>dest</code>.  For a latest index, does not ensure the new file is minimal.</p>

                              <div class="method-source-code" id="update_specs_index-source">
            <pre><span class="ruby-comment"># File rubygems/indexer.rb, line 413</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_specs_index</span>(<span class="ruby-identifier">index</span>, <span class="ruby-identifier">source</span>, <span class="ruby-identifier">dest</span>)
  <span class="ruby-identifier">specs_index</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">read_binary</span>(<span class="ruby-identifier">source</span>)

  <span class="ruby-identifier">index</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">platform</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">original_platform</span>
    <span class="ruby-identifier">platform</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span><span class="ruby-operator">::</span><span class="ruby-constant">RUBY</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">platform</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">platform</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">specs_index</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">version</span>, <span class="ruby-identifier">platform</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">specs_index</span> = <span class="ruby-identifier">compact_specs</span> <span class="ruby-identifier">specs_index</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">sort</span>

  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span> <span class="ruby-identifier">dest</span>, <span class="ruby-string">&quot;wb&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
    <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span> <span class="ruby-identifier">specs_index</span>, <span class="ruby-identifier">io</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

